<style>
    .hidden {
        display: none;
    }
</style>
<div class="layui-form" lay-filter="layuiadmin-form-admin" style="padding: 20px 30px 0 0;">
    <!-- <div class="layui-form-item">
        <label class="layui-form-label">serviceID</label>
        <div class="layui-input-inline">
            <script type="text/html" template>
                <input type="text" name="serviceId" value="{{ d.params.serviceId || '' }}" lay-verify="serviceId" autocomplete="off" class="layui-input">
            </script>
        </div>

    </div> -->
    <div class="layui-form-item">
        <label class="layui-form-label">服务名称</label>
        <div class="layui-input-inline">
            <script type="text/html" template>
                <input type="text" name="serviceName" value="{{ d.params.serviceName || '' }}" lay-verify="serviceName" autocomplete="off" class="layui-input">
            </script>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">服务英文名称</label>
            <div class="layui-input-inline">
                <script type="text/html" template>
                    <input type="text" name="serviceNameEn" value="{{ d.params.serviceNameEn || '' }}" autocomplete="off" class="layui-input">
                </script>
            </div>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">时间</label>
            <div class="layui-input-inline">
                <script type="text/html" template>
                    <input type="text" name="time" value="{{ d.params.time || '' }}" id="date" lay-verify="time" placeholder="yyyy-MM-dd" autocomplete="off" class="layui-input">
                </script>
            </div>
        </div>
    </div>
    <div class="layui-form-item layui-form-text">
        <label class="layui-form-label">详情</label>
        <div class="layui-input-block">
            <textarea id="demo" style="display: none;" value="{{ d.params.detail || '' }}"></textarea>
        </div>

    </div>
    <div class="btn-one">
        <fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;">
            <legend>上传服务图标</legend>
        </fieldset>
        <div class="layui-upload-drag" style="text-align: left;">
            <i class="layui-icon test2"></i>
            <p>点击上传服务图标</p>
            <script type="text/html" template>
                <div class="{{d.params.serviceId?'':'layui-hide'}}" id="uploadDemoView2">
                    <hr>
                    <img src="{{ d.params.serviceIcon || '' }}" style="max-width: 196px" />
                    <input class="hidden" name="serviceIcon" value="{{ d.params.serviceIcon || '' }}">
                </div>
            </script>
        </div>
    </div>
    <div class="btn-five" style=" margin: 30px 0px 0px 110px;">
        <div class="layui-input-inline">
            <input type="button" id="okbtn" lay-submit lay-filter="LAY-user-front-submit" value="确认" class="layui-btn" style="margin-bottom: 30px;">
        </div>
    </div>
</div>

<script>
    layui.use('upload', function() {
        var $ = layui.jquery,
            setter = layui.setter,
            upload = layui.upload;
        //上传图片
        upload.render({
            elem: '.test2',
            url: setter.request.baseUrl + '/upload/admin/file',
            exts: 'jpg|png|jpeg',
            done: function(res) {
                layer.msg('上传成功');
                layui.$('#uploadDemoView2').removeClass('layui-hide').find('img').attr('src', res.data.src);
                $("input[name='serviceIcon']").val(res.data.src)
            }
        });

    });
</script>